/**
 * 情侣关系相关API服务
 */

const http = require('./http');

/**
 * 创建情侣关系
 * @param {Object} data 情侣关系数据 {user1Id, user2Id}
 * @returns {Promise} Promise对象
 */
const createCouple = (data) => {
  return http.post('/api/couples', data);
};

/**
 * 获取当前用户的情侣关系
 * @returns {Promise} Promise对象
 */
const getCurrentCouple = () => {
  return http.get('/api/couples/current');
};

/**
 * 获取情侣详情
 * @param {Number} id 情侣关系ID
 * @returns {Promise} Promise对象
 */
const getCoupleDetail = (id) => {
  return http.get(`/api/couples/${id}`);
};

/**
 * 解除情侣关系
 * @param {Number} id 情侣关系ID
 * @returns {Promise} Promise对象
 */
const unbindCouple = (id) => {
  return http.del(`/api/couples/${id}`);
};

/**
 * 生成绑定码
 * @returns {Promise} Promise对象
 */
const generateBindCode = () => {
  return http.post('/api/couples/bind-code');
};

/**
 * 使用绑定码绑定情侣
 * @param {String} code 绑定码
 * @returns {Promise} Promise对象
 */
const bindWithCode = (code) => {
  return http.post('/api/couples/bind', { code });
};

module.exports = {
  createCouple,
  getCurrentCouple,
  getCoupleDetail,
  unbindCouple,
  generateBindCode,
  bindWithCode
};